
/**
 * @date 9:52:25 AM
 * EducationHomework.java
 * Administrator
 * TODO
 */
package com.qs.education.bean.entity;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.IndexColumn;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import lombok.Getter;
import lombok.Setter;

/**
 * @class EducationHomework
 * @author Warren
 * @description
 * @date Nov 15, 2018
 */
@Entity
@Table(name = "education_homework")
@Getter
@Setter
public class EducationHomeWork {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "id", unique = true, nullable = false)
	private Long id;
	private String startTime;
	private String endTime;
	@Column(name = "status")
	private String homeworkStatus;
	private Double correctRate;

	@ManyToOne
	@JoinColumn(name = "group_id")
	@JsonIgnoreProperties(value = { "teachers", "students", "teacher", "grade", "clazz", "homeWorkList", "createTime","messages"})
	private EducationGroup group;

	@ManyToOne
	@JoinColumn(name = "teacher_id")
	@JsonIgnoreProperties(value = { "group", "school", "groups", "subject", "homeWorkList", "mobile", "createTime",
			"teacherToken","messages","password" })
	private EducationTeacher teacher;

	@OneToMany
	@JoinColumn(name = "homework_id")
	@JsonIgnoreProperties(value = { "homework"})
	private List<EducationHomeWorkQuestion> homeWorkQuestionList;

	@ManyToMany
	@JoinTable(name = "education_homework_lesson", joinColumns = {
			@JoinColumn(name = "homework_id", referencedColumnName = "id") }, inverseJoinColumns = {
					@JoinColumn(name = "lesson_id", referencedColumnName = "id") })
	@JsonIgnoreProperties(value = { "unit", "questionList","homeworkList" })
	private List<EducationSubjectLesson> subjectLessonList;
	
	@OneToMany
	@JoinColumn(name="homework_id")
	@JsonIgnoreProperties(value = {"homework"})
	private List<EducationHomeWorkStudent> homeWorkStudentList;
}
